{% if 'nginx' in pillar %}
  {% set item = pillar['nginx'] %}
  {{ item['name'] }}:
    pkg:
      - {{ item['status'] }}
    file.managed:
      - source: {{ item['source'] }}
      - name: {{ item['file'] }}
      - user: {{ item['user'] }}
      - group: {{ item['group'] }}
      - mode: {{ item['mode'] }}
      - template: {{ item['template'] }}
    service.running:
      - enable: True
      - reload: True
  {{ item['root'] }}:
    file.directory:
      - user: {{ item['name'] }}
      - group: {{ item['name'] }}
      - mode: 755
      - makedirs: True
      - recurse:
        - user
        - group
        - mode
 {% endif %}